<template>
	<view class="my-settle-box">
		<label class="radio" @click="chooseAllRadio">
			<radio color="#C00000" :checked="isFullChecked"/><text>全选</text>
		</label>
		
		<view class="amount-box">
			合计： <text>￥{{sum}}</text>
		</view>
		
		<view class="settle-button">结算({{checkCount}})</view>
	</view>
</template>

<script>
	import { mapGetters,mapMutations } from 'vuex'
	
	export default {
		name: "my-settle",
		data() {
			return {

			};
		},
		computed: {
			...mapGetters('m_cart',['checkCount','sum','total']),
			// 是否全选
			isFullChecked(){
				return this.total === this.checkCount
			}
		},
		methods: {
			...mapMutations('m_cart',['updateAllRadioState']),
			chooseAllRadio(){
				this.updateAllRadioState(!this.isFullChecked)
			}
		}
	}
</script>

<style lang="scss">
.my-settle-box {
	width: 100%;
	height: 50px;
	position: fixed;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	font-size: 14px;
	justify-content: space-between;
	
	.radio{
		display: flex;
		align-items: center;
		padding-left: 5px;
	}
	.amount-box {
		text {
			color: #C00000;
			font-weight: bold;
		}
	}
	.settle-button {
		height: 50px;
		min-width: 100px;
		line-height: 50px;
		text-align: center;
		padding: 0 10px;
		background-color: #C00000;
		color: white;
	}
}
</style>